home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Nov 90 / MacApp.Tech$ 11⁄2⁄90 / 2286-BlockSet-Oct90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.4 KB  |  60 lines  |  [TEXT/GEOL]

  1. Item    4063007                         31-Oct-90        08:20PST
  2.  
  3. From:   PHAROS.TECH                     Pharos Tech, Tech Staff,PRT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    BlockSet
  8.  
  9. From: Schmitz, Scott D. on Wed, Oct 31, 1990 11:19 AM
  10. Subject: BlockSet
  11. To: MacApp
  12.  
  13. Below is a slightly improved version of BlockSet.  This version uses longword
  14. assignment when it can.  This should increase the speed.
  15.  
  16.  Procedure BlockSet (destPtr: Ptr;
  17.        byteCount: longint;
  18.        setVal: Univ SignedByte);
  19.  
  20.   Var
  21.    endPtr: Ptr;
  22.    LongSetVal: longint;
  23.    safeEndPtr: Ptr;
  24.  
  25.  Begin
  26.   destPtr := Ptr(StripLong(destPtr));
  27.   endPtr := Ptr(Ord(destPtr) + byteCount);
  28.   safeEndPtr := Ptr(Ord(destPtr) + BAND(bytecount, $FFFFFFFC));  {Trunc to
  29. nearest 4 bytes}
  30.  
  31.   {Lets get a 4 byte 'punch'.  If the compiler is worth anything it will place
  32. this in a register}
  33.   ResType(LongSetVal)[1] := Chr(setVal);
  34.   ResType(LongSetVal)[2] := Chr(setVal);
  35.   ResType(LongSetVal)[3] := Chr(setVal);
  36.   ResType(LongSetVal)[4] := Chr(setVal);
  37.  
  38. {Assign in 4 byte chunks what we can}
  39.   While Ord(destPtr) < Ord(safeEndPtr) Do
  40.   Begin
  41.    LongIntPtr(destPtr)^ := LongSetVal;
  42.    destPtr := Ptr(Ord(destPtr) + 4);
  43.   End;
  44.  
  45. {Now finish assigning odd bytes}
  46.   While Ord(destPtr) < Ord(endPtr) Do
  47.   Begin
  48.    destPtr^ := setVal;
  49.    destPtr := Ptr(Ord(destPtr) + 1);
  50.   End;
  51.  
  52.  End;
  53.  
  54.  
  55.  
  56. Scott Schmitz
  57. Pharos
  58.  
  59.  
  60.